# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

_realname=ack
pkgname=perl-${_realname}
pkgver=2.14
pkgrel=1
pkgdesc="A Perl-based grep replacement, aimed at programmers with large trees of heterogeneous source code"
arch=('any')
url="http://betterthangrep.com/"
license=('GPL' 'PerlArtistic')
depends=('perl-File-Next')
groups=('perl-modules')
options=(!emptydirs)
source=("http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/${_realname}-${pkgver}.tar.gz"
        '0001-ack-2.12-msys2.patch'
        '0002-ack-2.12-match-makefiles-with-more-generality.patch')
md5sums=('43cfa05123ba0440fa3958690ee03bac'
         'd52eb2e82c44765dc5242ed00d95b890'
         'cf516ac5023031ebb5d661bc8da64e5b')
prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i ${srcdir}/0001-ack-2.12-msys2.patch
  patch -p1 -i ${srcdir}/0002-ack-2.12-match-makefiles-with-more-generality.patch
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  # some standalone tests are failing
  make test || true
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make install DESTDIR="${pkgdir}"
}
